Some deploy services, such as Cloudflare Workers or Vercel, need our entire server code to be bundled into a single file.

The `dist/server/importBuild.js` file enables bundlers to discover the entire dependency tree of our server code.

To use it, we merely have to load it somewhere in our server code:

```js
// Some server file

import './path/to/dist/server/importBuild.js'
/* Or:
require('./path/to/dist/server/importBuild.js')
*/
```

> `dist/server/importBuild.js` works with any bundler, which means that we can use any bundler to bunlde the server-side code of our `vite-plugin-ssr` app.

## How it works

If you are curious, this is how `dist/server/importBuild.js` works:

```js
// dist/server/importBuild.js

const { pageFiles } = require("./pageFiles.js");
const clientManifest = require("../client/manifest.json");
const serverManifest = require("../server/manifest.json");
const { __private: { importBuild } } = require("vite-plugin-ssr");
importBuild({ pageFiles, clientManifest, serverManifest });
```

Normally, `vite-plugin-ssr` determines the path of these dependencies dynamically at run-time:

```js
// This is how `vite-plugin-ssr` does it normally:
const clientManifestFilePath = distPath + '/client/manifest.json'
const clientManifest = require(clientManifestFilePath)
```

The problem is that bundlers, which statically analyze code to determine dependencies, cannot determine the value of `distPath + '/client/manifest'` and therefore cannot find out about the dependency `dist/client/manifest.json`. This means that `dist/client/manifest.json` will be missing from our server bundle.

Thanks to `dist/server/importbuild.js`, bundlers can discover these dependencies.

The `dist/server/importBuild.js` file is generated by [`vite-plugin-import-build`](https://github.com/brillout/vite-plugin-import-build).
